package com.liuhongwei.test.builder.strategy.impl;


import com.liuhongwei.test.bean.TableInfo;
import com.liuhongwei.test.builder.BuildExtendMapperXml;
import com.liuhongwei.test.builder.strategy.inf.MapperXmlStrategy;

import java.io.BufferedWriter;
import java.io.IOException;

/**
 * 通用查询条件
 */
public class XmlFieldQueryConditionImpl implements MapperXmlStrategy {

    @Override
    public void generateMapperXml(TableInfo tableInfo, BufferedWriter bw) throws IOException {
        bw.write("\t<!--通用查询条件-->\n");
        bw.write("\t<sql id=\"" + BuildExtendMapperXml.QUERY_CONDITION + "\">\n");
        bw.write("\t\t<where>\n");
        bw.write("\t\t\t<include refid=\"" + BuildExtendMapperXml.BASE_QUERY_CONDITION + "\"/>\n");
        bw.write("\t\t\t<include refid=\"" + BuildExtendMapperXml.BASE_QUERY_CONDITION_EXTEND + "\"/>\n");
        bw.write("\t\t</where>\n");
        bw.write("\t</sql>\n\n");
    }
}
